# A valid snippet should starts with:
#
#		snippet trigger_word [ "description" [ options ] ]
#
# and end with:
#
#		endsnippet
#
# Snippet options:
#
#		b - Beginning of line.
#		i - In-word expansion.
#		w - Word boundary.
#		r - Regular expression
#		e - Custom context snippet
#		A - Snippet will be triggered automatically, when condition matches.
#
# Basic example:
#
#		snippet emitter "emitter properties" b
#		private readonly ${1} = new Emitter<$2>()
#		public readonly ${1/^_(.*)/$1/}: Event<$2> = this.$1.event
#		endsnippet
#
# Online reference: https://github.com/SirVer/ultisnips/blob/master/doc/UltiSnips.txt

snippet latex "latex"
\documentclass[11pt]{article}%文件类说明

%还可以选择的类是book,report

\setlength{\parindent}{12pt}%自然段第一行的缩进量为12pt

\setlength{\parskip}{10pt plus1ptminus1pt}

%自然段之间的距离为10pt，并可在8pt到11pt之间变化

\setlength{\baselineskip}{8pt plus2ptminus1pt}

%行间距为8pt，并可在7pt到10pt之间变化

\setlength{\textheight}{21truecm}%版面高为21厘米

\setlength{\textwidth}{14.5truecm}%版面宽为14.5厘米

\begin{document}%正文开始

\title{Thesis}%文章标题，双反斜杠\\表示换行

\author{author\\Dept. of Math.}

%作者名，单位，通信地址等，双反斜杠\\表示换行

\date{2003/8/5}

%文章写作日期，如果省略此行，计算机日期作为写作日期

\maketitle%建立标题部分

%文章的正文输入

\section{Introduction}%第一节引言（机器自动编号）

{\bf Theorem 1.} {\it For any fixed $\rho>0$,we have

$$||R(u,\rho)||\leq ||R_1(u,\rho)||\leq2||R(u,\rho)||,~~~\forall u\in H.

\eqno(10)$$ Hence, (2) and (3) are equivalent forany fixed$\rho>0$.}

%一般定理的写法

{\bf Proof.}

\begin{thebibliography}{99}

\bibitem{Kind} D. Kinderlehrer and G.Stampacchia, {\it An Introduction to

Variational Inequalities and Their Applications},Academic Press,New York, (1980).

\end{thebibliography}%参考文献

\end{document}%源文件的结束
endsnippet


snippet box "Box"
`!p snip.rv = '┌' + '─' * (len(t[1]) + 2) + '┐'`
│ $1 │
`!p snip.rv = '└' + '─' * (len(t[1]) + 2) + '┘'`
$0
endsnippet

snippet sin "sine"
\sin{$1}$0
endsnippet

snippet cos "cosine"
\cos{$1}$0
endsnippet

snippet partial "partial"
\partial{$1}$0
endsnippet

snippet beg "begin{} / end{}" bA
\begin{$1}
	$0
\end{$1}
endsnippet

snippet figure "figure" bA
\begin{figure}
	\centering   %设置对齐格式
	\includegraphics [width=0.75，height=2.5]{$1}  %指定图形大小和图形名称，一般将该图形放在latex文件同一路径下就不需要指明路径
	\caption{$2}  %设置图形标题
	\label{fig:arch}  %设置图形引用名称
\end{figure}$0
endsnippet

snippet equation "equation" bA
\begin{equation}
	$1
\end{equation}
endsnippet

snippet mk "Math" wA
$${1}$`!p
if t[2] and t[2][0] not in [',', '.', '?', '-', ' ']:
    snip.rv = ' '
else:
    snip.rv = ''
`$2
endsnippet

snippet dm "Math" wA
\[
$1
.\] $0
endsnippet

snippet '([A-Za-z])(\d)' "auto subscript" wrA
`!p snip.rv = match.group(1)`_`!p snip.rv = match.group(2)`
endsnippet

snippet '([A-Za-z])_(\d\d)' "auto subscript2" wrA
`!p snip.rv = match.group(1)`_{`!p snip.rv = match.group(2)`}
endsnippet

snippet sr "^2" iA
^2
endsnippet

snippet cb "^3" iA
^3
endsnippet

snippet compl "complement" iA
^{c}
endsnippet

snippet td "superscript" iA
^{$1}$0
endsnippet

snippet // "Fraction" iA
\\frac{$1}{$2}$0
endsnippet

snippet '((\d+)|(\d*)(\\)?([A-Za-z]+)((\^|_)(\{\d+\}|\d))*)/' "Fraction" wrA
\\frac{`!p snip.rv = match.group(1)`}{$1}$0
endsnippet

priority 1000
snippet '^.*\)/' "() Fraction" wrA
`!p
stripped = match.string[:-1]
depth = 0
i = len(stripped) - 1
while True:
	if stripped[i] == ')': depth += 1
	if stripped[i] == '(': depth -= 1
	if depth == 0: break;
	i -= 1
snip.rv = stripped[0:i] + "\\frac{" + stripped[i+1:-1] + "}"
`{$1}$0
endsnippet

snippet / "Fraction" iA
\\frac{${VISUAL}}{$1}$0
endsnippet

priority 10
snippet "bar" "bar" riA
\overline{$1}$0
endsnippet

priority 100
snippet "([a-zA-Z])bar" "bar" riA
\overline{`!p snip.rv=match.group(1)`}
endsnippet

priority 10
snippet "hat" "hat" riA
\hat{$1}$0
endsnippet

priority 100
snippet "([a-zA-Z])hat" "hat" riA
\hat{`!p snip.rv=match.group(1)`}
endsnippet

snippet "(\\?\w+)(,\.|\.,)" "Vector postfix" riA
\vec{`!p snip.rv=match.group(1)`}
endsnippet 


